@extends('admin.common.base-master')

@section('html-head')

@endsection

@section('html-body')
    <div id="content">
        <!-- cur-position start -->
        <div id="cur-position">
            <span class="tit">当前位置：</span>
            <a href="">首页图片管理</a>
        </div>
        
        <div class="table-box">
            <table class="table">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>图片</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @if(count($homeImgs) > 0)
                    @foreach($homeImgs as $homeImg)
                        <tr id="home_img_{{$homeImg->id}}">
                            <td>{{$homeImg->id}}</td>
                            <td class="account-td" style="width: 5%;">
                        <span class="photo" style="border-radius: 100%;display:initial">
                            @if($homeImg->img_id !== 0)
                                <a href="javascript:void(0);" class="openimg" data-key="{{$homeImg->img_id}}"><img src="{{$homeImg->img_url}}" alt="{{$homeImg->img_url}}"></a>
                            @else
                                <img src="{{url('images/default-avatar.png')}}" alt="">
                            @endif
                        </span>
                            </td>
                            <td><a class="color2" href="{{route('Admin.Home.homeImgSet')}}?id={{$homeImg->id}}">编辑</a> <span></td>
                        </tr>
                    @endforeach
                @endif
                </tbody>
            </table>
        </div>
    </div>
    <script>
        $(function(){

            $(document).on("click",".del",function(){
                var id = $(this).attr("data-id");
                $.ajax({
                    {{--url:'{{route("Api.Admin.sys.delBanner")}}',--}}
                    type:'post',
                    dataType:'json',
                    data:{id:id},
                    success:function(obj){
                        if(obj.level == "success"){
                            $("#home_img_"+id).hide('slow');
                        }else{
                            noty({type:obj.level,text:obj.message,timeout:600});
                        }
                    },
                    error:function(obj){
                        console.log(obj);
                    }

                });
            });
        });
    </script>
@endsection